#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int n;
	cin >> n;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());

	int T = n - 1;
	while (T--) {
		// alice
		auto idx = -1;
		int ans = 2e9;
		for (int i = 0; i < a.size(); i++) {
			auto t1 = upper_bound(b.begin(), b.end(), a[i]);
			if (t1 == b.end() && abs(a[i] - * (t1 - 1)) < ans) {
				idx = i;
				ans = abs(a[i] - * (t1 - 1));
			} else {
				int t2 = abs(a[i] - *t1);
				int t3 = abs(a[i] - * (t1 - 1));
				if (t2 < ans) {
					idx = i;
					ans = t2;
				}
				if (t3 < ans) {
					idx = i;
					ans = t3;
				}
			}
		}
		a.erase(idx + a.begin());

		// bob
		if (abs(b.back() - a[0]) > abs(b[0] - a.back())) {
			b.erase(b.end() - 1);
		} else {
			b.erase(b.begin());
		}
	}
	cout << abs(a[0] - b[0]);
	return 0;
}
